home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-05-01 | 21.5 KB | 680 lines | [TEXT/MPS ] |
- {
- File: Controls.p
-
- Contains: Control Manager interfaces
-
- Version: Technology: System 7.5
- Release: Universal Interfaces 3.0d3 on Copland DR1
-
- Copyright: © 1984-1996 by Apple Computer, Inc. All rights reserved.
-
- Bugs?: If you find a problem with this file, send the file and version
- information (from above) and the problem description to:
-
- Internet: apple.bugs@applelink.apple.com
- AppleLink: APPLE.BUGS
-
- }
- {$IFC UNDEFINED UsingIncludes}
- {$SETC UsingIncludes := 0}
- {$ENDC}
-
- {$IFC NOT UsingIncludes}
- UNIT Controls;
- INTERFACE
- {$ENDC}
-
- {$IFC UNDEFINED __CONTROLS__}
- {$SETC __CONTROLS__ := 1}
-
- {$I+}
- {$SETC ControlsIncludes := UsingIncludes}
- {$SETC UsingIncludes := 1}
-
- {$IFC UNDEFINED __TYPES__}
- {$I Types.p}
- {$ENDC}
- {$IFC UNDEFINED __QUICKDRAW__}
- {$I Quickdraw.p}
- {$ENDC}
- {$IFC UNDEFINED __MENUS__}
- {$I Menus.p}
- {$ENDC}
-
- {$PUSH}
- {$ALIGN MAC68K}
- {$LibExport+}
-
- {$IFC FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED }
- {
- _________________________________________________________________________________________________________
- • CONTROL DEFINITION ID'S
- _________________________________________________________________________________________________________
- Standard System 7 procID's
- }
-
- CONST
- pushButProc = 0;
- checkBoxProc = 1;
- radioButProc = 2;
- scrollBarProc = 16;
- popupMenuProc = 1008;
-
- {
- _________________________________________________________________________________________________________
- • VARIANT CODES
- _________________________________________________________________________________________________________
- }
-
- TYPE
- ControlVariant = SInt16;
-
- CONST
- kControlNoVariant = 0; { No variant }
- kControlUsesOwningWindowsFontVariant = $08; { Control uses owning windows font to display text }
-
- {
- _________________________________________________________________________________________________________
- • CONTROL PART CODES
- _________________________________________________________________________________________________________
- }
-
- TYPE
- ControlPartCode = SInt16;
-
- CONST
- kControlNoPart = 0;
- kControlLabelPart = 1;
- kControlMenuPart = 2;
- kControlTrianglePart = 4;
- kControlButtonPart = 10;
- kControlCheckBoxPart = 11;
- kControlRadioButtonPart = 11;
- kControlUpButtonPart = 20;
- kControlDownButtonPart = 21;
- kControlPageUpPart = 22;
- kControlPageDownPart = 23;
- kControlIndicatorPart = 129;
- kControlDisabledPart = 254;
- kControlInactivePart = 255;
-
- {
- _________________________________________________________________________________________________________
- • CHECK BOX VALUES
- _________________________________________________________________________________________________________
- }
- kControlCheckBoxUncheckedValue = 0;
- kControlCheckBoxCheckedValue = 1;
- kControlCheckBoxMixedValue = 2;
-
- {
- _________________________________________________________________________________________________________
- • RADIO BUTTON VALUES
- _________________________________________________________________________________________________________
- }
- kControlRadioButtonUncheckedValue = 0;
- kControlRadioButtonCheckedValue = 1;
- kControlRadioButtonMixedValue = 2;
-
- {
- _________________________________________________________________________________________________________
-
- • CONTROL POP-UP MENU CONSTANTS
- _________________________________________________________________________________________________________
- Variant codes for the System 7 pop-up menu
- }
- popupFixedWidth = $01;
- popupVariableWidth = $02;
- popupUseAddResMenu = $04;
- popupUseWFont = $08;
-
- { Menu label styles for the System 7 pop-up menu }
- popupTitleBold = $0100;
- popupTitleItalic = $0200;
- popupTitleUnderline = $0400;
- popupTitleOutline = $0800;
- popupTitleShadow = $1000;
- popupTitleCondense = $2000;
- popupTitleExtend = $4000;
- popupTitleNoStyle = $8000;
-
- { Menu label justifications for the System 7 pop-up menu }
- popupTitleLeftJust = $00000000;
- popupTitleCenterJust = $00000001;
- popupTitleRightJust = $000000FF;
-
- {
- _________________________________________________________________________________________________________
- • CONTROL DRAGGRAYRGN CONSTANTS
- For DragGrayRgnUPP used in TrackControl()
- _________________________________________________________________________________________________________
- }
- noConstraint = 0;
- hAxisOnly = 1;
- vAxisOnly = 2;
-
- {
- _________________________________________________________________________________________________________
- • CONTROL COLOR TABLE PART CODES
- _________________________________________________________________________________________________________
- }
- cFrameColor = 0;
- cBodyColor = 1;
- cTextColor = 2;
- cThumbColor = 3;
- kNumberCtlCTabEntries = 4;
-
- {
- _________________________________________________________________________________________________________
- • CONTROLHANDLE & CONTROLREF
- _________________________________________________________________________________________________________
- }
-
- TYPE
- ControlRecordPtr = ^ControlRecord;
- ControlPtr = ^ControlRecord;
- ControlHandle = ^ControlPtr;
- ControlRef = ControlHandle;
- {
- _________________________________________________________________________________________________________
- • CONTROL ACTIONPROC POINTER
- _________________________________________________________________________________________________________
- }
- ControlActionProcPtr = ProcPtr; { PROCEDURE ControlAction(theControl: ControlHandle; partCode: ControlPartCode); }
-
- ControlActionUPP = UniversalProcPtr;
- {
- _________________________________________________________________________________________________________
- • CONTROL COLOR TABLE
- _________________________________________________________________________________________________________
- }
- CtlCTabPtr = ^CtlCTab;
- CtlCTab = RECORD
- ccSeed: SInt32;
- ccRider: SInt16;
- ctSize: SInt16;
- ctTable: ARRAY [0..3] OF ColorSpec;
- END;
-
- CCTabPtr = ^CtlCTab;
- CCTabHandle = ^CCTabPtr;
- {
- _________________________________________________________________________________________________________
- • CONTROL RECORD
- _________________________________________________________________________________________________________
- }
- ControlRecord = PACKED RECORD
- nextControl: ControlHandle;
- contrlOwner: WindowPtr;
- contrlRect: Rect;
- contrlVis: UInt8;
- contrlHilite: UInt8;
- contrlValue: SInt16;
- contrlMin: SInt16;
- contrlMax: SInt16;
- contrlDefProc: Handle;
- contrlData: Handle;
- contrlAction: ControlActionUPP;
- contrlRfCon: SInt32;
- contrlTitle: Str255;
- END;
-
- {
- _________________________________________________________________________________________________________
- • AUXILLARY CONTROL RECORD STRUCTURE
- _________________________________________________________________________________________________________
- }
- AuxCtlRecPtr = ^AuxCtlRec;
- AuxCtlRec = RECORD
- acNext: Handle;
- acOwner: ControlHandle;
- acCTable: CCTabHandle;
- acFlags: SInt16;
- acReserved: SInt32;
- acRefCon: SInt32;
- END;
-
- AuxCtlPtr = ^AuxCtlRec;
- AuxCtlHandle = ^AuxCtlPtr;
- {
- _________________________________________________________________________________________________________
- • POP-UP MENU PRIVATE DATA STRUCTURE
- _________________________________________________________________________________________________________
- }
- PopupPrivateDataPtr = ^PopupPrivateData;
- PopupPrivateData = RECORD
- mHandle: MenuHandle;
- mID: SInt16;
- END;
-
- PopupPrivateDataHandle = ^PopupPrivateDataPtr;
- {
- _________________________________________________________________________________________________________
- • CONTROL ACTION PROC UPP'S
- _________________________________________________________________________________________________________
- }
-
- CONST
- uppControlActionProcInfo = $000002C0;
-
- FUNCTION NewControlActionProc(userRoutine: ControlActionProcPtr): ControlActionUPP;
- {$IFC NOT GENERATINGCFM }
- INLINE $2E9F;
- {$ENDC}
-
- PROCEDURE CallControlActionProc(theControl: ControlHandle; partCode: ControlPartCode; userRoutine: ControlActionUPP);
- {$IFC NOT GENERATINGCFM}
- INLINE $205F, $4E90;
- {$ENDC}
- {
- _________________________________________________________________________________________________________
-
- • CONTROL CREATION / DELETION API'S
- _________________________________________________________________________________________________________
- }
- FUNCTION NewControl(owningWindow: WindowPtr; {CONST}VAR boundsRect: Rect; controlTitle: Str255; initiallyVisible: BOOLEAN; initialValue: SInt16; minimumValue: SInt16; maximumValue: SInt16; procID: SInt16; controlReference: SInt32): ControlHandle;
- {$IFC NOT GENERATINGCFM}
- INLINE $A954;
- {$ENDC}
- FUNCTION GetNewControl(resourceID: SInt16; owningWindow: WindowPtr): ControlHandle;
- {$IFC NOT GENERATINGCFM}
- INLINE $A9BE;
- {$ENDC}
- PROCEDURE DisposeControl(theControl: ControlHandle);
- {$IFC NOT GENERATINGCFM}
- INLINE $A955;
- {$ENDC}
- PROCEDURE KillControls(theWindow: WindowPtr);
- {$IFC NOT GENERATINGCFM}
- INLINE $A956;
- {$ENDC}
- {
- _________________________________________________________________________________________________________
-
- • CONTROL SHOWING/HIDING API'S
- _________________________________________________________________________________________________________
- }
- PROCEDURE ShowControl(theControl: ControlHandle);
- {$IFC NOT GENERATINGCFM}
- INLINE $A957;
- {$ENDC}
- PROCEDURE HideControl(theControl: ControlHandle);
- {$IFC NOT GENERATINGCFM}
- INLINE $A958;
- {$ENDC}
- {
- _________________________________________________________________________________________________________
-
- • CONTROL DRAWING API'S
- _________________________________________________________________________________________________________
- }
- PROCEDURE DrawControls(theWindow: WindowPtr);
- {$IFC NOT GENERATINGCFM}
- INLINE $A969;
- {$ENDC}
- PROCEDURE Draw1Control(theControl: ControlHandle);
- {$IFC NOT GENERATINGCFM}
- INLINE $A96D;
- {$ENDC}
- PROCEDURE UpdateControls(theWindow: WindowPtr; updateRegion: RgnHandle);
- {$IFC NOT GENERATINGCFM}
- INLINE $A953;
- {$ENDC}
- {
- _________________________________________________________________________________________________________
-
- • CONTROL HIGHLIGHT API'S
- _________________________________________________________________________________________________________
- }
- PROCEDURE HiliteControl(theControl: ControlHandle; hiliteState: ControlPartCode);
- {$IFC NOT GENERATINGCFM}
- INLINE $A95D;
- {$ENDC}
- {
- _________________________________________________________________________________________________________
-
- • CONTROL TRACKING/DRAGGING API'S
- _________________________________________________________________________________________________________
- When using the TrackControl() call when tracking an indicator, the actionProc parameter (type ControlActionUPP)
- should be replaced by a parameter of type DragGrayRgnUPP (see Quickdraw.h).
- }
- FUNCTION TrackControl(theControl: ControlHandle; startPoint: Point; actionProc: ControlActionUPP): ControlPartCode;
- {$IFC NOT GENERATINGCFM}
- INLINE $A968;
- {$ENDC}
- PROCEDURE DragControl(theControl: ControlHandle; startPoint: Point; {CONST}VAR limitRect: Rect; {CONST}VAR slopRect: Rect; axis: DragConstraint);
- {$IFC NOT GENERATINGCFM}
- INLINE $A967;
- {$ENDC}
- FUNCTION TestControl(theControl: ControlHandle; testPoint: Point): ControlPartCode;
- {$IFC NOT GENERATINGCFM}
- INLINE $A966;
- {$ENDC}
- FUNCTION FindControl(testPoint: Point; theWindow: WindowPtr; VAR theControl: ControlHandle): ControlPartCode;
- {$IFC NOT GENERATINGCFM}
- INLINE $A96C;
- {$ENDC}
- {
- _________________________________________________________________________________________________________
-
- • CONTROL MOVING/SIZING API'S
- _________________________________________________________________________________________________________
- }
- PROCEDURE MoveControl(theControl: ControlHandle; h: SInt16; v: SInt16);
- {$IFC NOT GENERATINGCFM}
- INLINE $A959;
- {$ENDC}
- PROCEDURE SizeControl(theControl: ControlHandle; w: SInt16; h: SInt16);
- {$IFC NOT GENERATINGCFM}
- INLINE $A95C;
- {$ENDC}
- {
- _________________________________________________________________________________________________________
-
- • CONTROL TITLE API'S
- _________________________________________________________________________________________________________
- }
- PROCEDURE SetControlTitle(theControl: ControlHandle; title: Str255);
- {$IFC NOT GENERATINGCFM}
- INLINE $A95F;
- {$ENDC}
- PROCEDURE GetControlTitle(theControl: ControlHandle; VAR title: Str255);
- {$IFC NOT GENERATINGCFM}
- INLINE $A95E;
- {$ENDC}
- {
- _________________________________________________________________________________________________________
-
- • CONTROL VALUE, MIMIMUM, AND MAXIMUM API'S
- _________________________________________________________________________________________________________
- }
- FUNCTION GetControlValue(theControl: ControlHandle): SInt16;
- {$IFC NOT GENERATINGCFM}
- INLINE $A960;
- {$ENDC}
- PROCEDURE SetControlValue(theControl: ControlHandle; newValue: SInt16);
- {$IFC NOT GENERATINGCFM}
- INLINE $A963;
- {$ENDC}
- FUNCTION GetControlMinimum(theControl: ControlHandle): SInt16;
- {$IFC NOT GENERATINGCFM}
- INLINE $A961;
- {$ENDC}
- PROCEDURE SetControlMinimum(theControl: ControlHandle; newMinimum: SInt16);
- {$IFC NOT GENERATINGCFM}
- INLINE $A964;
- {$ENDC}
- FUNCTION GetControlMaximum(theControl: ControlHandle): SInt16;
- {$IFC NOT GENERATINGCFM}
- INLINE $A962;
- {$ENDC}
- PROCEDURE SetControlMaximum(theControl: ControlHandle; newMaximum: SInt16);
- {$IFC NOT GENERATINGCFM}
- INLINE $A965;
- {$ENDC}
- {
- _________________________________________________________________________________________________________
-
- • CONTROL VARIANT AND WINDOW INFORMATION API'S
- _________________________________________________________________________________________________________
- }
- FUNCTION GetControlVariant(theControl: ControlHandle): ControlVariant;
- {$IFC NOT GENERATINGCFM}
- INLINE $A809;
- {$ENDC}
- {
- _________________________________________________________________________________________________________
-
- • CONTROL ACTION PROC API'S
- _________________________________________________________________________________________________________
- }
- PROCEDURE SetControlAction(theControl: ControlHandle; actionProc: ControlActionUPP);
- {$IFC NOT GENERATINGCFM}
- INLINE $A96B;
- {$ENDC}
- FUNCTION GetControlAction(theControl: ControlHandle): ControlActionUPP;
- {$IFC NOT GENERATINGCFM}
- INLINE $A96A;
- {$ENDC}
- {
- _________________________________________________________________________________________________________
-
- • CONTROL ACCESSOR API'S
- _________________________________________________________________________________________________________
- }
- PROCEDURE SetControlReference(theControl: ControlHandle; data: SInt32);
- {$IFC NOT GENERATINGCFM}
- INLINE $A95B;
- {$ENDC}
- FUNCTION GetControlReference(theControl: ControlHandle): SInt32;
- {$IFC NOT GENERATINGCFM}
- INLINE $A95A;
- {$ENDC}
- FUNCTION GetAuxiliaryControlRecord(theControl: ControlHandle; VAR acHndl: AuxCtlHandle): BOOLEAN;
- {$IFC NOT GENERATINGCFM}
- INLINE $AA44;
- {$ENDC}
- PROCEDURE SetControlColor(theControl: ControlHandle; newColorTable: CCTabHandle);
- {$IFC NOT GENERATINGCFM}
- INLINE $AA43;
- {$ENDC}
- {
- _________________________________________________________________________________________________________
-
- • VALID 'CDEF' MESSAGES
- _________________________________________________________________________________________________________
- }
-
- TYPE
- ControlDefProcMessage = SInt16;
-
- CONST
- drawCntl = 0;
- testCntl = 1;
- calcCRgns = 2;
- initCntl = 3;
- dispCntl = 4;
- posCntl = 5;
- thumbCntl = 6;
- dragCntl = 7;
- autoTrack = 8;
- calcCntlRgn = 10;
- calcThumbRgn = 11;
- drawThumbOutline = 12;
-
- {
- _________________________________________________________________________________________________________
-
- • MAIN ENTRY POINT FOR 'CDEF'
- _________________________________________________________________________________________________________
- }
-
- TYPE
- ControlDefProcPtr = ProcPtr; { FUNCTION ControlDef(varCode: SInt16; theControl: ControlHandle; message: ControlDefProcMessage; param: SInt32): SInt32; }
-
- ControlDefUPP = UniversalProcPtr;
-
- CONST
- uppControlDefProcInfo = $00003BB0;
-
- FUNCTION NewControlDefProc(userRoutine: ControlDefProcPtr): ControlDefUPP;
- {$IFC NOT GENERATINGCFM }
- INLINE $2E9F;
- {$ENDC}
-
- FUNCTION CallControlDefProc(varCode: SInt16; theControl: ControlHandle; message: ControlDefProcMessage; param: SInt32; userRoutine: ControlDefUPP): SInt32;
- {$IFC NOT GENERATINGCFM}
- INLINE $205F, $4E90;
- {$ENDC}
- {
- _________________________________________________________________________________________________________
-
- • CONSTANTS FOR DRAWCNTL MESSAGE PASSED IN PARAM
- _________________________________________________________________________________________________________
- }
-
- CONST
- kDrawControlEntireControl = 0;
- kDrawControlIndicatorOnly = 129;
-
- {
- _________________________________________________________________________________________________________
-
- • CONSTANTS FOR DRAGCNTL MESSAGE PASSED IN PARAM
- _________________________________________________________________________________________________________
- }
- kDragControlEntireControl = 0;
- kDragControlIndicator = 1;
-
- {
- _________________________________________________________________________________________________________
-
- • DRAG CONSTRAINT STRUCTURE PASSED IN PARAM FOR THUMBCNTL MESSAGE (IM I-332)
- _________________________________________________________________________________________________________
- }
-
- TYPE
- IndicatorDragConstraintPtr = ^IndicatorDragConstraint;
- IndicatorDragConstraint = RECORD
- limitRect: Rect;
- slopRect: Rect;
- axis: DragConstraint;
- END;
-
- IndicatorDragConstraintHandle = ^IndicatorDragConstraintPtr;
- {$IFC OLDROUTINENAMES }
- {
- _________________________________________________________________________________________________________
- • OLDROUTINENAMES
- _________________________________________________________________________________________________________
- Variants applicable to all controls (at least ones with text)
- }
-
- CONST
- useWFont = 8;
-
- inLabel = 1;
- inMenu = 2;
- inTriangle = 4;
- inButton = 10;
- inCheckBox = 11;
- inUpButton = 20;
- inDownButton = 21;
- inPageUp = 22;
- inPageDown = 23;
- inThumb = 129;
-
- kNoHiliteControlPart = 0;
- kInLabelControlPart = 1;
- kInMenuControlPart = 2;
- kInTriangleControlPart = 4;
- kInButtonControlPart = 10;
- kInCheckBoxControlPart = 11;
- kInUpButtonControlPart = 20;
- kInDownButtonControlPart = 21;
- kInPageUpControlPart = 22;
- kInPageDownControlPart = 23;
- kInIndicatorControlPart = 129;
- kReservedControlPart = 254;
- kControlInactiveControlPart = 255;
-
- PROCEDURE SetCTitle(theControl: ControlHandle; title: Str255);
- {$IFC NOT GENERATINGCFM}
- INLINE $A95F;
- {$ENDC}
- PROCEDURE GetCTitle(theControl: ControlHandle; VAR title: Str255);
- {$IFC NOT GENERATINGCFM}
- INLINE $A95E;
- {$ENDC}
- PROCEDURE UpdtControl(theWindow: WindowPtr; updateRgn: RgnHandle);
- {$IFC NOT GENERATINGCFM}
- INLINE $A953;
- {$ENDC}
- PROCEDURE SetCtlValue(theControl: ControlHandle; theValue: INTEGER);
- {$IFC NOT GENERATINGCFM}
- INLINE $A963;
- {$ENDC}
- FUNCTION GetCtlValue(theControl: ControlHandle): INTEGER;
- {$IFC NOT GENERATINGCFM}
- INLINE $A960;
- {$ENDC}
- PROCEDURE SetCtlMin(theControl: ControlHandle; minValue: INTEGER);
- {$IFC NOT GENERATINGCFM}
- INLINE $A964;
- {$ENDC}
- FUNCTION GetCtlMin(theControl: ControlHandle): INTEGER;
- {$IFC NOT GENERATINGCFM}
- INLINE $A961;
- {$ENDC}
- PROCEDURE SetCtlMax(theControl: ControlHandle; maxValue: INTEGER);
- {$IFC NOT GENERATINGCFM}
- INLINE $A965;
- {$ENDC}
- FUNCTION GetCtlMax(theControl: ControlHandle): INTEGER;
- {$IFC NOT GENERATINGCFM}
- INLINE $A962;
- {$ENDC}
- PROCEDURE SetCRefCon(theControl: ControlHandle; data: LONGINT);
- {$IFC NOT GENERATINGCFM}
- INLINE $A95B;
- {$ENDC}
- FUNCTION GetCRefCon(theControl: ControlHandle): LONGINT;
- {$IFC NOT GENERATINGCFM}
- INLINE $A95A;
- {$ENDC}
- PROCEDURE SetCtlAction(theControl: ControlHandle; actionProc: ControlActionUPP);
- {$IFC NOT GENERATINGCFM}
- INLINE $A96B;
- {$ENDC}
- FUNCTION GetCtlAction(theControl: ControlHandle): ControlActionUPP;
- {$IFC NOT GENERATINGCFM}
- INLINE $A96A;
- {$ENDC}
- PROCEDURE SetCtlColor(theControl: ControlHandle; newColorTable: CCTabHandle);
- {$IFC NOT GENERATINGCFM}
- INLINE $AA43;
- {$ENDC}
- FUNCTION GetCVariant(theControl: ControlHandle): INTEGER;
- {$IFC NOT GENERATINGCFM}
- INLINE $A809;
- {$ENDC}
- {$ENDC}
- {
- *****************************************************************************
- * *
- * The conditional STRICT_CONTROLS has been removed from this interface file.*
- * The accessor macros to a ControlRecord are no longer necessary. *
- * *
- *****************************************************************************
-
- Details:
- The original purpose of the STRICT_ conditionals and accessor macros was to
- help ease the transition to Copland. Shared data structures are difficult
- to coordinate in a preemptive multitasking OS. By hiding the fields in a
- WindowRecord and other data structures, we would begin the migration to
- system data structures being completely hidden from applications.
-
- After many design reviews, it was finally concluded that with this sort of
- migration, the system could never tell when an application was no longer
- peeking at a WindowRecord, and thus the data structure might never become
- system owned. Additionally, there were many other limitations in the classic
- toolbox that were begging to be addressed.
-
- The final decision was to leave the traditional toolbox as a compatibility mode.
- The preferred toolbox API for Copland is a new SOM(tm) based architecture
- (e.g. HIWindows.idl). Windows, menu, controls, etc are each a SOM object
- with methods for drawing, event handling, and customization.
-
- }
- {$ENDC}
- {$ALIGN RESET}
- {$POP}
-
- {$SETC UsingIncludes := ControlsIncludes}
-
- {$ENDC} {__CONTROLS__}
-
- {$IFC NOT UsingIncludes}
- END.
- {$ENDC}
-